package com.it.xyx.code.asyncDemo;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserDataMapper extends BaseMapper<UserData> {
    // 启用批量插入模式
    @Insert("<script>INSERT INTO user_data (name, content, create_time) VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.name}, #{item.content}, #{item.createTime})</foreach></script>")
    void batchInsert(@Param("list") List<UserData> list);
}
